interface Shape1{
    double PI=3.14159;
    double fun();
}
class Circle1 implements Shape1{
    public double x;
    public Circle1(double x){
        this.x=x;
    }
    @Override
    public double fun() {
        return 2*PI*x;
    }
}
class Square1 implements Shape1{
    public double a;
    public double b;
    public Square1(double a,double b){
        this.a=a;
        this.b=b;
    }
    @Override
    public double fun() {
        return a*4;
    }
}
public class TestDemo {
    public static void main(String[] args) {
        Square1 square=new Square1(4,3);
        System.out.println("正方形的周长："+square.fun());
        Circle1 circle=new Circle1(3);
        System.out.println("⚪的周长"+circle.fun());

        System.out.println("===========");
        Shape1 shape2=new Square1(3,4);
        System.out.println(shape2.fun());
        Shape1 shape1=new Circle1(3);
        System.out.println(shape1.fun());

        System.out.println("=============");
        Shape1 s1=new Square1(3,4);
        System.out.println(s1.fun());
        Shape1 s2=new Circle1(3);
        System.out.println(s2.fun());

        System.out.println("================");
        Shape1[] s=new Shape1[4];
        s[0]=new Square1(3,2);
        s[1]=new Square1(3,4);
        s[2]=new Circle1(2.4);
        s[3]=new Circle1(6.1);
        for(int i=0;i<4;i++){
            double sum=0;
            sum+=s[i].fun();
            System.out.println("总面积之和是："+sum);
        }
    }
}
